package com.todo.member.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/3/4 04:19
 * @description
 */
@Getter
@AllArgsConstructor
public enum LevelStatusEnum {

    DRAFT(1, "DRAFT", "草稿"),
    WAITING_AUDIT(2, "WAITING_AUDIT", "待审核"),
    AUDIT_SUCCESS(3, "AUDIT_SUCCESS", "审核成功"),
    RUNNING(4, "RUNNING", "已上线"),
    SHUTDOWN(5, "SHUTDOWN", "已停止"),
            ;

    private static Map<Integer, LevelStatusEnum> typeMap = Arrays
            .stream(LevelStatusEnum.values())
            .collect(Collectors.toMap(LevelStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static LevelStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
